//
//  LQYRegisterController.m
//  BuDeJie
//
//  Created by runone02 on 2018/6/15.
//  Copyright © 2018年 李启云. All rights reserved.
//

#import "LQYRegisterController.h"
#import "LQYRegisterView.h"
#import "LQYLoginBassController.h"
@interface LQYRegisterController ()
@property (nonatomic, strong) LQYRegisterView *registerView;
@end

@implementation LQYRegisterController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"注册";
    [self loadRegisterView];
}

- (void)loadRegisterView{
    self.view.backgroundColor = [UIColor whiteColor];
    self.registerView = [[LQYRegisterView alloc]init];
    [self.view addSubview:self.registerView];
    [self.registerView.nextBtn addTarget:self action:@selector(nextBtnClick:) forControlEvents:UIControlEventTouchUpInside];
    [self.registerView.isVisual addTarget:self action:@selector(isVisual:) forControlEvents:UIControlEventTouchUpInside];
    [self.registerView.enrollBtn addTarget:self action:@selector(enrollBtnClick:) forControlEvents:UIControlEventTouchUpInside];
    
    [self.registerView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.view).with.offset(kTopBarHeight+40);
        make.left.right.bottom.mas_equalTo(self.view);
    }];
}

//按钮点击
- (void)isVisual:(UIButton *)button {
    button.selected = !button.selected;
    if (button.selected == YES) {
        
        self.registerView.isVisual.backgroundColor = [UIColor blackColor];
        self.registerView.passWordTF.secureTextEntry = NO;
    } else {
        button.selected = !button.selected;
        self.registerView.isVisual.backgroundColor = [UIColor redColor];
        self.registerView.passWordTF.secureTextEntry = YES;
    }
}

//注册登录
- (void)enrollBtnClick:(UIButton *)button {
    LQYLoginBassController *pass = [[LQYLoginBassController alloc]init];
    [self.navigationController pushViewController:pass animated:YES];
}

//登录
- (void)nextBtnClick:(UIButton *)button {
    NSLog(@"登录");
}

@end
